<div class="page-header" style="text-align: center;">
    <h3>Đăng ký</h3>
</div>
<?php
$attributes = array('class' => 'form-horizontal');
echo form_open("thanhvien/thanhvien/submit_registration", $attributes);
?>
<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">Thông tin tài khoản</h3>
    </div>
    <div class="panel-body">
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="email_address">Email</label>
            </div>
            <div class="col-xs-6">
                <input type="email" id="email_address" Class="form-control" placeholder="Email..."
                       name="email_address" value="<?php echo set_value('email_address'); ?>" />
                       <?php echo form_error('email_address', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>

        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="email">Xác nhận email</label>
            </div>                        
            <div class="col-xs-6">
                <input type="email" id="con_email" Class="form-control" placeholder="Nhập lại Email ..."
                       name="con_email" value="<?php echo set_value('con_email'); ?>" />
                       <?php echo form_error('con_email', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="password">Password</label>
            </div>
            <div class="col-xs-6">
                <input type="password" id="password" Class="form-control" placeholder="Mật khẩu ..."
                       name="password" value="<?php echo set_value('password'); ?>" />
                       <?php echo form_error('password', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>

        </div>
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="con_password">Xác nhận password</label>
            </div>
            <div class="col-xs-6">
                <input type="password" id="con_password" Class="form-control" placeholder="Nhập lại mật khẩu..."
                       name="con_password" value="<?php echo set_value('con_password'); ?>" />
                       <?php echo form_error('con_password', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="user_name">Username</label>
            </div>
            <div class="col-xs-6">
                <input type="text" id="username" Class="form-control" placeholder="Tên đăng nhập của bạn..."
                       name="username" value="<?php echo set_value('username'); ?>" />
                       <?php echo form_error('username', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="sexual">Giới tính</label>
            </div>
            <div class="col-xs-6">
                <select type="text" id="sexual" Class="form-control"  name="sexual">
                    <option value="0">Nam</option>
                    <option value="1">Nữ</option>
                    <option value="2">Khác</option>
                </select>
                       <?php echo form_error('sexual', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>
    </div>
</div>

<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">Bảo mật thông tin</h3>
    </div>
    <div class="panel-body">
        <div class="form-group row">
            <div class="col-xs-4">
                <label class="control-label" for="seccode">Mã xác nhận</label>
            </div>
            <div class="col-xs-6">
                <?php echo recaptcha_get_html('6Lc9Z-8SAAAAAOa298dF4Lw1EG1-f7xmoB2ij-T6', $error); ?>
                <?php echo form_error('recaptcha_challenge_field', '<p class="text-danger" style="font-size:15px;">', '</p>'); ?>
            </div>
        </div>
    </div>
</div>
<div class="form-group">
    <div class="col-xs-4"></div>
    <div class="col-xs-3">
        <button type="submit" class="btn btn-primary btn-lg btn-block">Đăng ký</button>
    </div>
    <div class="col-xs-2">
        <button type="reset" class="btn btn-default btn-lg btn-block">Hủy</button>
    </div>
</div>
<?php echo form_close(); ?>
<script>
    $(function(){
       $('#email_address').keydown(function(e) {
            var $this = $(this);
            setTimeout(function() {
                var text = $this.val();
                text=text.split("@")[0];
                $('#username').val(text);
            }, 0);
        });
        $('#email_address').change(function(e) {
                var text = $(this).val();
                text=text.split("@")[0];
                $('#username').val(text);
        });
    });
</script>